% A simple demo of BBE for a binary image: 
% proposed in Signal Processing 2016.
% Shuang Yi (yishuang0227@gmail.com); 2016-11-13

clear, clc, close all
prev_dir = pwd; file_dir = fileparts(mfilename('fullpath')); cd(file_dir); addpath(genpath(pwd));
im=imread('lena.png');
[r,c]=size(im);
s=8; % block size s X s, s>=3
[embeddedImg,capacity]=BBE(im,s);
if capacity>0
    display(['block size = ' num2str(s) ' X ' num2str(s)]);
    display(['ER = ' num2str(capacity/(r*c)) ' bpp']);
    figure;imshow(embeddedImg,[]);
else
    display('Cannot embed any data!');
end